class Solution {
public:
    bool isPalindrome(ListNode* head) {
int i,j;
int a[100000] = {0},m= 0;
    while(head)
    {
        a[m] = head->val;
        head = head->next;
        m++;
    }
    for(i = 0,j = m-1; i<j; i++,j--)
    {
        if(a[i]!=a[j])
        {
            return false;
        }
    }
    return true;
    }
};